package main

import (
	"exporter/dao"
	"exporter/models"
	"exporter/service"
	"fmt"
)

func main6() {
	err := dao.InitSqlite()
	//db, err := gorm.Open(sqlite.Open("./sqlite.db"), &gorm.Config{})
	//if err != nil {
	//	panic("failed to connect database")
	//}
    dao.DB.AutoMigrate(&models.Process{})


    //p := models.Process{
	//	Name:"测试命令2",
	//	Command : "pwd",
	//	StartTime: time.Now(),
	//	UpdateTime: time.Now(),
	//	Count: 0,
	//	Comments: "init data",
	//	KeyWord: "key",
	//	ShutdownCmd: "kill -9 xx",
	//	Status: false,
	//}
	//models.CreateAProcess(&p)
	processList, err := models.GetAllProcess()
	if err != nil {
		panic("----")
	}
	for _, process := range processList {
		fmt.Printf("%#v\n",process)
	}
	str := service.CheckCmdStatus(123)
	fmt.Println("str--->",str)
	//process, err := models.GetAProcess("2")
	//fmt.Printf("%#v\n",process)
	//process.KeyWord = "wei"
	//models.UpdateAProcess(process)
	//
	//process, err = models.GetAProcess("2")
	//fmt.Printf("%#v\n",process)
	//
	//err = models.DeleteAProcess("2")
}
